#include "hplcqinfinepumpsendsystempacket.h"
#include "hplcqinfinepumpprotocoldata.h"
#include "common/hplcqinfinepfcid.h"

namespace hplc
{
namespace qinfine
{

HplcQinfinePumpSendSystemPacket::HplcQinfinePumpSendSystemPacket(HplcQinfinePumpProtocolData &data)
{
    m_d = &data;
}

void HplcQinfinePumpSendSystemPacket::setWorkMode(quint8 mode, quint8 flag)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_WORKMODE, mode, flag);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::getWorkMode()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_WORKMODE);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::setFlowCalibDataCMD(quint8 cmd)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_FLOWCALIB_DATA_CMD, cmd);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::setFlowCalibData(float flow, float realFlow)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_FLOWCALIB_DATA, flow, realFlow);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::getFlowCalibData()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_FLOWCALIB_DATA);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::setFlowCalibLoadFlow(float flow)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_FLOWCALIB_LOAD_FLOW, flow);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::getFlowCalibLoadFlow()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_FLOWCALIB_LOAD_FLOW);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::setFlowCalibLoadRealFlow(float flow)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_FLOWCALIB_LOAD_REALFLOW, flow);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::getFlowCalibLoadRealFlow()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_FLOWCALIB_LOAD_REALFLOW);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::setFlowCalibLoadPress(float press)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_FLOWCALIB_LOAD_PRESS, press);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::getFlowCalibLoadPress()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_FLOWCALIB_LOAD_PRESS);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::setPressCalibDataCMD(quint8 cmd)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_PRESSCALIB_DATA_CMD, cmd);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::setPressCalibData(float press, float realPress)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_PRESSCALIB_DATA, press, realPress);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::getPressCalibData()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_PRESSCALIB_DATA);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::setPulseCompenDataCMD(quint8 cmd)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_PULSECOMPEN_DATA_CMD, cmd);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::setPulseCompenData(float position, float compenFactor)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_PULSECOMPEN_DATA, position, compenFactor);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::getPulseCompenData()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_PULSECOMPEN_DATA);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::setPulseCompenDebugCMD(quint8 cmd)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_PULSECOMPEN_DEBUG_CMD, cmd);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::getPulseCompenGearPos()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_PULSECOMPEN_GEAR_POS);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::setStepMotorCurrentRun(quint8 current)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_STEPMOTOR_IRUN, current);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::getStepMotorCurrentRun()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_STEPMOTOR_IRUN);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::setMotorCurrentDataCMD(quint8 cmd)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_MOTORCURRENT_DATA_CMD, cmd);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::setMotorCurrentData(float flow, quint8 current)
{
    m_d->m_maker->makePacket(SET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_MOTORCURRENT_DATA, flow, current);
    m_d->m_checker->sendRetry();
}

void HplcQinfinePumpSendSystemPacket::getMotorCurrentData()
{
    m_d->m_maker->makePacket(GET_PFC(PFC_PUMP_EXT_SYSTEM), (quint8)PFC_PES_MOTORCURRENT_DATA);
    m_d->m_checker->sendRetry();
}

} // qinfine
} // hplc
